<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="shortcut icon" href="./../../../favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="../../../static/css/font.css">
    <link rel="stylesheet" href="../../../static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../../../static/css/buildUnit/common.css">
    <script type="text/javascript" src="/lib/mxDraw/mxcustom.js"></script>
    <style>
        body {
            padding: 10px;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }

        #content {
            height: 100%;
        }

        .drawingObj {
            height: 100%;
            width: 100%;
        }
    </style>
</head>
<body>
<div id="content">

</div>
<script src="../../../static/js/main.js"></script>
<script>
    //例子图纸：http://61.55.140.248:8094/ysb_store_path/drawing/6e6fbe961ac84e768f8e2c76fe65520d/761364b59d4a4804b695d9d95103ea83/b084bdeed5854c1ba80ecd5e1113bb2f.dwg
    var decId;
    var $;
    var configure;
    layui.use([
        'layer',
        'configure',
        'configureCom',
        'sessionFun',
        'pdf',
        'jquery',
        'bluebird'
    ], function () {
        configure = layui.configure;
        var configureCom = layui.configureCom;
        var sessionFun = layui.sessionFun;
        var pdf = layui.pdf;
        $ = layui.jquery;
        //获取图纸对象
        //获得图纸申报id
        decId = configureCom.GetQueryString('decId');
        //demo图纸
        var url = configure.HOST + configure.EXAMINE_ATTACHMRNT_POLICY_REPORT_PDF_HTTP + '?decId=' + decId + '&token=' + configureCom.getToken();
        pdf.init('drawingId', url, '#content');
    });

    //保存签章
    function signSave() {
        return new Promise(function (resolve, reject) {
            var url = configure.HOST + configure.SIGN_SAVE_HTTP + '?decId=' + decId + '&token=' + configureCom.getToken();
            var status = $('#drawingId')[0].HttpClient.UploadToServer(url);
            var timer = setInterval(function () {
                if (status == 200) {
                    clearTimeout(timer);
                    resolve({code: 1, msg: '签章保存成功'});
                } else {
                    clearTimeout(timer);
                    resolve({code: 0, msg: '签章保存失败'});
                }
            }, 1000)
        })
    }


</script>
</body>
</html>